package org.ne.banksys.service.serviceImpl;

import org.ne.banksys.entity.Deposit;
import org.ne.banksys.mapper.DepositMapper;
import org.ne.banksys.service.DepositService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author wey
 * @date 2025/6/13 下午10:43 06
 **/

@Service
public class DepositServiceImpl implements DepositService {


    @Autowired
    private DepositMapper depositMapper;


    @Override
    public Long getSavingId(String savingName){
        return depositMapper.getSavingId(savingName);
    }


    @Override
    public String getSavingName(Long savingId) {
        return depositMapper.getSavingNameById(savingId);
    }

    @Override
    public Deposit getDeposit(String depositName) {
        return depositMapper.getSavingByName(depositName);
    }

    @Override
    public void saveDeposit(Deposit deposit) {
        depositMapper.insert(deposit);
    }

    @Override
    public void updateDeposit(Deposit deposit) {
        depositMapper.update(deposit);
    }

    @Override
    public void deleteDeposit(Long depositId) {
        depositMapper.delete(depositId);
    }

    @Override
    public List<Deposit> getDeposits() {
        return depositMapper.getAll();
    }

}
